﻿//初始化defalut页面js

jQuery.noConflict();
jQuery(document).ready(function() {
    lastBlock = jQuery("#a1");
    maxWidth = 524;
    minWidth = 30;
    jQuery(".charMark").click(
           function() {
               document.getElementById("txt_TrainNumber").value += jQuery(this)[0].src.slice(-5).substring(0, 1).toUpperCase();
           }
            );
    jQuery("#imgMap").tooltip({
        track: true,
        delay: 0,
        showURL: false,
        showBody: " - ",
        fade: 250
    });

    jQuery("#Price").tooltip({
        track: true,
        delay: 0,
        showURL: false,
        showBody: " - ",
        fade: 250
    });

    jQuery(".box_k ul li .atemp").click(
             function() {
                 jQuery(lastBlock).animate({ width: minWidth + "px" }, { queue: false, duration: 400 });
                 jQuery(this).animate({ width: maxWidth + "px" }, { queue: false, duration: 400 });
                 lastBlock = this;
             }
           );

//    jQuery(".charMark").click(
//           function() {
//             document.getElementById("txt_TrainNumber").value += jQuery(this)[0].src.slice(-5).substring(0, 1).toUpperCase();
//           }
//            );
    jQuery(".msnqq").hover(
            function() { jQuery(this).addClass("msnqq_hover") },
            function() { jQuery(this).removeClass("msnqq_hover") }
                );

    jQuery(".box_k ul li a ").hover(
                      function() {
                          // alert(jQuery(this)[0].childNodes[0].src);
                          var oSrc = jQuery(this)[0].childNodes[0].src;
                          //alert(oSrc.replace(/k_d/ig, "k_"))
                          jQuery(this)[0].childNodes[0].src = oSrc.replace(/k_d/ig, "k_");
                      },
                      function() {
                          var oSrc = jQuery(this)[0].childNodes[0].src;
                          //alert(oSrc.replace(/k_d/ig, "k_"))
                          jQuery(this)[0].childNodes[0].src = oSrc.replace(/k_/ig, "k_d");
                      }
                 );
       InitDefault(); //加载flash 聊天框
   });

   function LoadEtalk() {
       var html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="358" height="248" ID="starSWF"  style="background-color:Yellow;border:#ccc 1px solid" align="middle">'
       html += '<param name="allowScriptAccess" value="always" />'
       html += '<param name="movie" value="../../Content/images/etalk.swf" />'
       html += '<param name="wmode" value="Opaque"/>'
       //html+='<param name="FlashVars" value="xmlData='+flashXmlSrc+'" />'
       html += '<param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />'
       html += '<embed name="starSWF" src="../../Content/images/etalk.swf" wmode="Opaque" quality="high" bgcolor="#ffffff" width="358" height="248" name="starSWF" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
       html += '</object>'
       $("Etalkswfpalce").innerHTML = "";
       $("Etalkswfpalce").innerHTML = html;
   }

   function JsToFlashCode(agentKey, agentName, agentTel) {
       $("starSWF").runFlashScript(agentKey, agentName,agentTel);
   }

   var newWindow;
   function SearchStation() {
       var var_StartStation = $("txt_StartStation").value
       var var_EndStation = $("txt_EndStation").value

       if (var_StartStation != "" && var_EndStation != "") {
          var  newSrc = "TrainSearch.aspx?StartStation=" + escape(var_StartStation) + "&EndStation=" + escape(var_EndStation) + ""
//          newWindow = window.open(newSrc, "win", "")
          //           newWindow.focus();
          alert(newSrc);
          window.location.href = newSrc

       }
       else {
           var var_TrainNumber = $("txt_TrainNumber").value;
           if (var_TrainNumber != "" && var_TrainNumber != undefined) {
               newWindow = window.open("TrainNumberSearch.aspx?TrainNumber=" + var_TrainNumber + "", "win", "");
               newWindow.focus();
           }
       }
   }

//   function CommTrainNumber(flag) {
//       if (flag) {
//           $("txt_TrainNumber").value = "";
//       }
//       else {
//           var s = $("txt_TrainNumber").value;
//           $("txt_TrainNumber").value = s.substring(0, s.length-1)
//       }
//   }